using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using TimeTableManagement.Entities;

namespace TimeTableManagement.Mapping
{
	public class Tb_TeachtimeMap : EntityTypeConfiguration<Tb_Teachtime>
	{
		public Tb_TeachtimeMap()
		{
			// Primary Key
			this.HasKey(t => t.id);

			// Properties
			this.Property(t => t.id)
				.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
				
			// Table & Column Mappings
			this.ToTable("Tb_Teachtime");
			this.Property(t => t.id).HasColumnName("id");
			this.Property(t => t.id_lecturer).HasColumnName("id_lecturer");
			this.Property(t => t.value).HasColumnName("value");

			// Relationships
			this.HasRequired(t => t.Tb_People)
				.WithMany(t => t.Tb_Teachtime)
				.HasForeignKey(d => d.id_lecturer);
				
		}
	}
}

